<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('联系人等级列表')" />
    <style>
        .container-div {
            padding: 20px;
            background: #f8fafc;
        }
        .search-collapse {
            background: #fff;
            border-radius: 8px;
            padding: 20px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            margin-bottom: 20px;
        }
        .select-list ul {
            display: flex;
            flex-wrap: wrap;
            margin: 0;
            padding: 0;
            list-style: none;
            align-items: center;
        }
        .select-list li {
            display: flex;
            align-items: center;
            margin-right: 20px;
            margin-bottom: 10px;
        }
        .select-list label {
            margin-right: 8px;
            font-weight: 500;
            color: #5a6a85;
            min-width: 70px;
            text-align: right;
        }
        .select-list input {
            border: 1px solid #e4e6ef;
            border-radius: 6px;
            padding: 8px 12px;
            transition: all 0.3s;
            width: 180px;
        }
        .select-list input:focus {
            border-color: #5d78ff;
            box-shadow: 0 0 0 3px rgba(93, 120, 255, 0.1);
        }
        #toolbar {
            margin-bottom: 20px;
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }
        #toolbar a {
            border-radius: 6px;
            font-weight: 500;
            box-shadow: 0 2px 6px rgba(0,0,0,0.05);
            transition: all 0.2s;
            padding: 8px 15px;
        }
        #toolbar a:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }
        .table-striped {
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            overflow: hidden;
        }
        #bootstrap-table {
            border: none;
        }
        #bootstrap-table thead th {
            background-color: #f8fafc;
            color: #5a6a85;
            font-weight: 600;
            border-bottom: 1px solid #e4e6ef;
            padding: 12px 15px;
        }
        #bootstrap-table tbody td {
            padding: 12px 15px;
            border-bottom: 1px solid #e4e6ef;
            vertical-align: middle;
        }
        #bootstrap-table tbody tr:last-child td {
            border-bottom: none;
        }
        #bootstrap-table tbody tr:hover {
            background-color: #f8fafc;
        }
        .btn-xs {
            padding: 4px 10px;
            font-size: 12px;
            border-radius: 4px;
            margin: 0 3px;
            box-shadow: none;
        }
        .btn-success {
            background-color: #50cd89;
            border-color: #50cd89;
        }
        .btn-primary {
            background-color: #5d78ff;
            border-color: #5d78ff;
        }
        .btn-danger {
            background-color: #f1416c;
            border-color: #f1416c;
        }
        .btn-warning {
            background-color: #ffc700;
            border-color: #ffc700;
        }
        .disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }
        .fa {
            margin-right: 5px;
        }
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>等级名称：</label>
                            <input type="text" name="levelName" placeholder="请输入等级名称"/>
                        </li>
                        <li>
                            <label>等级数值：</label>
                            <input type="text" name="levelValue" placeholder="请输入等级数值"/>
                        </li>
                        <li>
                            <label>用户ID：</label>
                            <input type="text" name="userId" placeholder="请输入用户ID"/>
                        </li>
                        <li class="search-btns">
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()">
                                <i class="fa fa-search"></i>&nbsp;搜索
                            </a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()">
                                <i class="fa fa-refresh"></i>&nbsp;重置
                            </a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="contact:level:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="contact:level:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="contact:level:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="contact:level:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" class="table-hover"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('contact:level:edit')}]];
    var removeFlag = [[${@permission.hasPermi('contact:level:remove')}]];
    var prefix = ctx + "contact/level";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "联系人等级",
            columns: [{
                checkbox: true
            },
            {
                field: 'levelId',
                title: '等级ID',
                visible: false
            },
            {
                field: 'levelName',
                title: '等级名称',
                sortable: true
            },
            {
                field: 'levelValue',
                title: '等级数值',
                sortable: true
            },
            {
                field: 'userId',
                title: '用户ID',
                sortable: true
            },
            {
                title: '操作',
                align: 'center',
                formatter: function(value, row, index) {
                    var actions = [];
                    actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.levelId + '\')"><i class="fa fa-edit"></i>编辑</a>');
                    actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.levelId + '\')"><i class="fa fa-remove"></i>删除</a>');
                    return actions.join(' ');
                }
            }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>